<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //当网页加载完成时 弹出提示框
        window.onload = function () {
            alert('欢迎光临我的小店');
        }
        window.onbeforeunload = function (event) {
            var e = event || window.event;
            e.returnValue = "你真的想要离开吗?";
        }
    </script>
</head>

<body>

</body>

</html>